Skip to content

Conversation

@castelao
Copy link
Member

Just notify that the requested config file does not exist to speed up debugging process.

@castelao castelao self-assigned this Nov 13, 2025
Copilot AI review requested due to automatic review settings November 13, 2025 22:43
@castelao castelao requested a review from ppinchuk as a code owner November 13, 2025 22:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves error handling in the load_config function by adding an explicit check for config file existence, raising a COMPASSValueError with a clear message when the file does not exist. This helps speed up the debugging process by providing immediate feedback instead of potentially less clear errors from attempting to open a non-existent file.

Key Changes:

  • Added file existence validation in load_config function before attempting to read the config file
  • Raises COMPASSValueError with a descriptive message when the config file is missing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +222 to +224
if not config_fp.exists():
msg = f"Config file does not exist: {config_fp}"
raise COMPASSValueError(msg)
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring's "Raises" section should be updated to document the new error condition. It currently only mentions the case when the config file doesn't end with .json or .json5, but it should also mention that COMPASSValueError is raised when the config file does not exist.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@ppinchuk ppinchuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!!

I'm really surprised that config_fp.open didn't raise a similar error. Actually maybe it did, but it wasn't captured by our logs. Throwing a COMPASSValueError will add the error to our logs, so this should be a good workaround.

@castelao castelao merged commit 67be478 into main Nov 13, 2025
19 checks passed
@castelao castelao deleted the fix/notify_missing_configfile branch November 13, 2025 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants